<?php

namespace frontend\modules\goods\models;

use Yii;

/**
 * This is the model class for table "collect".
 *
 * @property string $rec_id
 * @property string $user_id
 * @property string $goods_id
 */
class Collect extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'collect';
    }


    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
//            TimestampBehavior::className(),
            // 名为myBehavior4的行为，也是给出了MyBehavior类的配置数组
            'uuid' => [
                'class' => \common\behavior\uuidBehavior::className(),
                'owner' => $this
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            ['rec_id','default','value'=>$this->getUUID()],
            [['rec_id'], 'required'],
            [['rec_id', 'user_id', 'goods_id'], 'string', 'max' => 40],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'rec_id' => 'Rec ID',
            'user_id' => 'User ID',
            'goods_id' => 'Goods ID',
        ];
    }

    /**
     * @inheritdoc
     * @return \frontend\modules\goods\models\query\CollectQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new \frontend\modules\goods\models\query\CollectQuery(get_called_class());
    }
}
